package api

const (
	SUCCESS = 200
)

var (
	OK = NewError(SUCCESS, "请求成功")

	UserNamePassEmptyErr = NewError(20000, "用户名密码不能为空")
	UserNameEmptyErr     = NewError(20001, "用户名不能为空")

	UserNameNickNameEmptyErr = NewError(20005, "用户名或昵称不能为空")
	NickNameTooLongErr       = NewError(20007, "用户昵称过长")

	ProfileUploadErr = NewError(20008, "用户头像上传错误")
	ProfileSizeErr   = NewError(20009, "用户头像尺寸错误")
	ProfileTypeErr   = NewError(20010, "用户头像文件类型错误")

	JwtValidationErr = NewError(90001, "令牌验证失败")
)

func NewError(code int, text string) *ErrorCode {
	return &ErrorCode{code, text}
}

type ErrorCode struct {
	Code    int
	Message string
}
